package hut.ai.team.main;

import hut.ai.team.core.SoundManager;
import hut.ai.team.screen.SplashScreen;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.GL10;

public class CoUpGame extends Game {
	private static CoUpGame instance;
	public AssetManager manager;
	public SoundManager sound;
//	public FontManager font;
//	public Util util;
	public float assumeWidth;
	public float assumeHeight;
	
	public CoUpGame() {
		instance = this;
	}
	
	@Override
	public void create() {
		manager = new AssetManager();
		sound = new SoundManager(this);
//		font = new FontManager();
//		util = new Util();
		fixResolution();
		setScreen(SplashScreen.getInstance());
	}

	private void fixResolution() {
		// 960x640
		// 480x320
		assumeWidth = 480;
		assumeHeight = 800;
	}

	public float convertWidth(float x) {
		// if(viewport 480x320) return x/2;
		return x;
	}

	public float convertHeight(float y) {
		// if(viewport 480x320) return y/2;
		return y;
	}
	
	
	@Override
	public void render() {
		super.render();
		Gdx.gl.glClearColor(0, 0, 0, 1);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
		if (getScreen() != null) {
			getScreen().render(Gdx.graphics.getDeltaTime());
		}
	}
	
	public static CoUpGame getInstance() {
		return instance;
	}
}
